@echo off
chcp 65001 > nul
cd /d "D:\Codes\longimagereader\build\bin"

echo 开始运行程序并收集调试信息...
echo ========================================
echo 请在程序中测试PDF加载功能
echo 程序崩溃或关闭后，请按任意键查看日志
echo ========================================

set QT_LOGGING_RULES=*.debug=true

LongImageReader.exe 2>debug_output.txt

echo.
echo 程序已退出，检查调试日志...
if exist pdf_debug.log (
    echo.
    echo === PDF调试日志 ===
    type pdf_debug.log
)

if exist debug_output.txt (
    echo.
    echo === Qt调试输出 ===
    type debug_output.txt
)

pause